<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<link href="./images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="./images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script> 
	<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
	<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
	<link href="./images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<title></title>
</head>
{yun:}if $adminuser.is_crm!=1{/yun}
<style>
	.duty{display:none;}
</style>
{yun:}/if{/yun}
<body class="body_ifm">
	
	<div class="infoboxp"> 
		<div class="admin_new_tip">
		<a href="javascript:;" class="admin_new_tip_close"></a>
		<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
		<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
		<div class="admin_new_tip_list_cont">
			<div class="admin_new_tip_list">添加管理员功能根据运营需求，超级管理员可以自由添加网站的多个超级管理员、分站管理员、CRM业务员等常规化设置。</div>
			<div class="admin_new_tip_list">真实姓名填写：如果作为招聘顾问展示，建议填写虚拟称呼，如：客服-小王</div>
			<div class="admin_new_tip_list">设置为业务员/招聘顾问后，可对业务员信息进行补充完善</div>
		</div>
	</div>

	<div class="clear"></div>


	<div class="common-form">
		<div class="tag_box mt10">

			<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe> 
			<form name="myform" action="index.php?m=admin_user&c=save"   target="supportiframe" method="post" id="myform" onsubmit="return saveUseradd();" class="layui-form" enctype="multipart/form-data">

				<input type="hidden" value="{yun:}$adminuser.uid{/yun}" name="uid" />
				<input type="hidden" name="pytoken" id='pytoken' value="{yun:}$pytoken{/yun}">

				<table width="100%" class="table_form " >
					
					<thead>
						<tr class="admin_table_trbg">
						<th width="15%" bgcolor="#f0f6fb"><span class="admin_bold">参数说明</span></th>
						<td width="35%" bgcolor="#f0f6fb"><span class="admin_bold">参数值</span></td>   
						<th width="15%" bgcolor="#f0f6fb"><span class="admin_bold">参数说明</span></th>
						<td width="35%" bgcolor="#f0f6fb"><span class="admin_bold">参数值</span></td>   
						</tr>
					</thead>
					
					<tbody>
						<tr>
							<th>用户名：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="text" name="username" id="username"  lay-verify="required" placeholder="请输入用户名" value="{yun:}$adminuser.username{/yun}" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
								</div>
							</td>
							<th>密码：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-inline" style="margin-right:30px;">
										<input type="password" name="password" id="password"  lay-verify="required" placeholder="请输入密码" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
									{yun:}if is_array($adminuser){/yun}<span class="admin_web_tip">如果密码留空则不修改密码！</span>{yun:}/if{/yun}
								</div>
							</td>
						</tr>
						 

						<tr>
							<th>真实姓名：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-inline" style="margin-right:30px;">
										<input type="text" name="name" id="name"  lay-verify="required" placeholder="请输入真实姓名" value="{yun:}$adminuser.name{/yun}" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
								</div>
							</td>
							
							<th>用户组：</th>
							<td>
								<div class="layui-input-inline">
									<select name="m_id" id="m_id_val">
										<option value="">请选择</option>
										{yun:}foreach item=v from=$user_group{/yun}
										<option value="{yun:}$v.id{/yun}"{yun:}if $v.id eq $adminuser.m_id{/yun}selected{yun:}/if{/yun}>{yun:}$v.group_name{/yun}</option>
										{yun:}/foreach{/yun}
									</select>
								</div>
							</td>
							
						</tr>
						
						<tr>
							<th>是否可以登录分站：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input name="isdid" value="1" title="可以登录" {yun:}if $adminuser.isdid=="1"{/yun}checked{yun:}/if{/yun} type="radio"/>
										<input name="isdid" value="2" title="不可以登录" {yun:}if $adminuser.isdid=="2"{/yun}checked{yun:}/if{/yun} type="radio"/>
									</div>
								</div>
							</td>
							
							<th >业务员/招聘顾问：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="checkbox" name="is_crm" value="1" lay-skin="switch" lay-text="是|否" {yun:}if $adminuser.is_crm==1{/yun} checked="" {yun:}/if{/yun} lay-filter="is_crm">
										<span class="admin_web_tip">业务轮值安排，可以设轮值时间和区域</span>
									</div>
								</div>
							</td>
							
						</tr>
						
					 	<tr class="admin_table_trbg duty">
				       		<th width="160" bgcolor="#f0f6fb" colspan="4"><span class="admin_bold">业务员/招聘顾问信息</span></th>
				    	</tr>
						<tr class="admin_table_trbg duty" >
							<th>所属部门</th>
							<td colspan="3">
								<div class="layui-input-inline">
									<select name="depart" id="depart" lay-filter="depart">
										<option value="">请选择</option>
										{yun:}foreach item=v from=$crmDepart{/yun}
										<option value="{yun:}$v{/yun}"{yun:}if $v eq $adminuser.depart{/yun}selected{yun:}/if{/yun}>{yun:}$crmClassName[$v]{/yun}</option>
										{yun:}/foreach{/yun}
									</select>
								</div>
							</td>
						</tr>
						
						<tr class="duty">
						
							<th >业务提醒开关：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="checkbox" name="r_status" value="1" lay-skin="switch" lay-text="是|否" {yun:}if $adminuser.r_status==1{/yun} checked{yun:}/if{/yun} >
									</div>
								</div>
							</td>
							<th>微信号：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="text" name="weixin" id="weixin"  lay-verify="required" placeholder="请输入微信号" value="{yun:}$adminuser.weixin{/yun}" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
								</div>
							</td>
							
						</tr>
						
						<tr class="duty">
							<th>手机号：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="text" name="moblie" id="moblie"  lay-verify="required" placeholder="请输入手机号" value="{yun:}$adminuser.moblie{/yun}" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
								</div>
							</td>
							<th>联系QQ：</th>
							<td>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<input type="text" name="qq" id="qq"  lay-verify="required" placeholder="请输入联系QQ" value="{yun:}$adminuser.qq{/yun}" size="30"  autocomplete="off" class="layui-input input-text">
									</div>
								</div>
							</td>
							
						</tr>
						
						<tr class="duty">	
							<th>职业形象照：</th>
							<td>
								<button type="button" class="yun_bth_pic noupload" lay-data="{imgid: 'imgphoto'}">上传形象</button>
								<input type="hidden" id="laynoupload" value="1"/>
								<img id="imgphoto" src="{yun:}$adminuser.photo_n{/yun}" style="width:100px;height:100px;" {yun:}if !$adminuser.photo{/yun}class="none"{yun:}/if{/yun}>
							</td>
							<th>微信二维码：</th>
							<td>
								<button type="button" class="yun_bth_pic noupload2" lay-data="{imgid: 'imgewm'}">上传二维码</button>
								<img id="imgewm" src="{yun:}$adminuser.ewm_n{/yun}" style="width:100px;height:100px;" {yun:}if !$adminuser.ewm{/yun}class="none"{yun:}/if{/yun}>
							</td>
						</tr>

						<tr class="duty">
							<th>轮值时间：</th>
							<td colspan='3'>
								<div class="layui-form-item">
									<div class="layui-input-block">
										{yun:}foreach from=$week key=key item=v{/yun}
											<input name="crm_duty[]" title="{yun:}$v{/yun}" value="{yun:}$key{/yun}" lay-skin="primary" {yun:}if in_array($key,$adminuser.crm_duty){/yun}checked="checked"{yun:}/if{/yun} type="checkbox"><div class="layui-unselect layui-form-checkbox " ><span>{yun:}$v{/yun}</span><i class="layui-icon"></i></div>
										{yun:}/foreach{/yun}
									</div>
								</div>
							</td>
						</tr>
						<tr class="duty">
							<th>轮值区域：</th>
							<td colspan='3'>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<div class="yun_resume_popup_chose_box news_expect_text_new  news_expect_text_re9" style="width:500px;">  
											<input name='crm_city' id='crm_city' value="{yun:}$adminuser.crm_city{/yun}" type='hidden' />
											<select id="cityclass_search" name="cityclass_search" xm-select-type="cityclass" xm-select="cityclass_search" xm-select-search="" xm-select-max="" xm-select-skin="default"  xm-select-direction="down">
											<option value="">输入区域名称搜索选择</option>
											</select>
 										</div>
									</div>
								</div>
							</td>
						</tr>
						
						<tr>
							<th style="border-bottom:none;">&nbsp;</th>
							<td align="left" style="border-bottom:none;"> 
								<input class="layui-btn layui-btn-normal" name="useradd" type="submit"  value="提交" id="dosubmit">
							</td>
						</tr>
						

					</tbody>
				</table>
				
			</form>
		</div>
	</div>

</div>

<script src="{yun:}$config.sy_weburl{/yun}/data/plus/city.cache.js?v={yun:}$config.cachecode{/yun}" type="text/javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/data/plus/cityparent.cache.js?v={yun:}$config.cachecode{/yun}" type="text/javascript"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/formSelects-v4.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/formSelects-v4.js?v={yun:}$config.cachecode{/yun}"></script>

<script language="javascript">
	layui.use(['layer', 'form','element'], function(){

		var layer = layui.layer
			,form = layui.form
			,element = layui.element
			,formSelects = layui.formSelects
			,$ = layui.$;
		
		form.on('switch(is_crm)', function(data){
 			if(data.elem.checked){
				$(".duty").show();
			}else{
				$(".duty").hide();
			}
			form.render();
		});

		formSelects.btns('cityclass_search', ['remove']);

		formSelects.on('cityclass_search', function(id, vals, val, isAdd, isDisabled){
			var cityvalue = [];
            vals.forEach(function(item,index){
            	cityvalue.push(item.value);
            })
            $('#crm_city').val(cityvalue.join(','));
        }, true);
		

	});//end layui.use()

	'{yun:}if $adminuser.crm_city{/yun}'
		 
		var formSelects = layui.formSelects, 
			cityclassArr= $("#crm_city").val()!='' ? $("#crm_city").val().split(",") : [],
	        carr = [];

	    for(var i=0;i<cityclassArr.length;i++){
	    	carr.push({"name":cn[cityclassArr[i]],"value":cityclassArr[i],"selected":'selected'});
	    }
	    formSelects.data('cityclass_search', 'local', {
	        arr: carr
	    });
		 
	'{yun:}/if{/yun}'
	
	function saveUseradd(){

		var username = $.trim($("#username").val());
		var password = $.trim($("#password").val());
		var name = $.trim($("#name").val());
		var m_id_val = $.trim($("#m_id_val").val());
		var moblie = $("#moblie").val();
		var isdid = $('input[name="isdid"]:checked').val();
		
		if(username==""){
			parent.layer.msg('请填写用户名！', 2, 8);
			return false;
		}
		
		{yun:}if !is_array($adminuser){/yun}
			if(password==""){
				parent.layer.msg('请填写密码！', 2, 8);
				return false;
			}
		{yun:}/if{/yun}
		
		if(name==""){
			parent.layer.msg('请填写真实姓名！', 2, 8);
			return false;
		}
		if(m_id_val==""){
			parent.layer.msg('请选择用户组类型！', 2, 8);
			return false;
		}
		if(!isdid){
			parent.layer.msg('请选择是否登录分站！', 2, 8);
			return false;
		}
		if (moblie && isjsMobile(moblie) == false) {
			layer.msg('手机号格式错误！', 2, 8);
			return false;
		}
	}
</script>

<script type="text/javascript">
	layui.use('upload', function(){
		var $ = layui.$
			,upload = layui.upload
			,layer = layui.layer
			,device = layui.device();
		
		var laynoupload = $("#laynoupload").val(); 		   //1、选完不上传            
		//选完不上传，url暂未用到，只是需要其样式
		
		if (laynoupload == 1){
 			//上传文件类型
			var layaccept = 'images', layexts = 'jpg|png|gif|bmp|jpeg';
			 
			upload.render({
				elem: '.noupload'
				,auto: false
				,accept: layaccept
				,exts: layexts
				,field:'photo'
				,choose: function(obj){
					if(this.imgid){
						//预读本地文件示例，不支持ie8/9
						var imgid = null;
						if(this.imgid){
							imgid = this.imgid;
						}
						obj.preview(function(index, file, result){
							if(imgid && $('#'+imgid).length>0){
								$('#'+imgid).removeClass('none');
								$('#'+imgid).attr('src', result); //图片链接（base64）
							}
						});
					}
				}
			});
			upload.render({
				elem: '.noupload2'
				,auto: false
				,accept: layaccept
				,exts: layexts
				,field:'ewm'
				,choose: function(obj){
					if(this.imgid){
						//预读本地文件示例，不支持ie8/9
						var imgid = null;
						if(this.imgid){
							imgid = this.imgid;
						}
						 
						obj.preview(function(index, file, result){
							if(imgid && $('#'+imgid).length>0){
								$('#'+imgid).removeClass('none');
								$('#'+imgid).attr('src', result); //图片链接（base64）
							}
						});
					}
				}
			});
		}
		
	});

</script>
</body>
</html>